package com.authsphere.security.common.user;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serial;
import java.util.Collection;

/**
 * @program: AuthSphere
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/22 11:26
 **/
public class ErrorUserDetails implements UserDetails {
    @Serial
    private static final long serialVersionUID = 7467100855647349040L;

    private final static String ERROR_MESSAGE = "用户信息错误，不支持该操作";

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        throw new UnsupportedOperationException(ERROR_MESSAGE);
    }

    @Override
    public String getPassword() {
        throw new UnsupportedOperationException(ERROR_MESSAGE);
    }

    @Override
    public String getUsername() {
        throw new UnsupportedOperationException(ERROR_MESSAGE);
    }

    @Override
    public boolean isAccountNonExpired() {
        throw new UnsupportedOperationException(ERROR_MESSAGE);
    }

    @Override
    public boolean isAccountNonLocked() {
        throw new UnsupportedOperationException(ERROR_MESSAGE);
    }

    @Override
    public boolean isCredentialsNonExpired() {
        throw new UnsupportedOperationException(ERROR_MESSAGE);
    }

    @Override
    public boolean isEnabled() {
        throw new UnsupportedOperationException(ERROR_MESSAGE);
    }
}
